package com.lj.controller;

import com.lj.service.ArchiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author lj
 * @Description: ArchiveShowController
 * @date 2020-10-05 21:57
 * @QQ 851477108
 */
@Controller
public class ArchiveShowController {

    @Autowired
    private ArchiveService archiveService;

    /**
     * 根据年份归档博客
     * @param model
     * @return
     */
    @GetMapping("/archives")
    public String archives(Model model) {
        model.addAttribute("archiveMap", archiveService.archiveBolg());
        model.addAttribute("blogCount", archiveService.countBlog());
        return "archives";
    }
}
